package cn.study.luckyapp.activity.query;

import cn.study.luckyapp.assembler.ActivityAssembler;
import cn.study.luckyclient.dto.data.ActivityVo;
import cn.study.luckyclient.dto.query.ActivityListByParamQuery;
import cn.study.luckydomain.activity.ActivityEntity;
import cn.study.luckydomain.gateway.ActivityGateway;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class ActivityListByParamQueryExe {
    private final ActivityGateway activityGateway;
    public IPage<ActivityVo> execute(ActivityListByParamQuery query){
        IPage<ActivityEntity> page = activityGateway.page(query);
        return page.convert(ActivityAssembler::toActivityVO);
    }
}
